//
// Created by longyunbo on 7/21/21.
//

#ifndef ANALYSIS_STACKVALUECOLLECTION_H
#define ANALYSIS_STACKVALUECOLLECTION_H
#include "stack"
#include "StackValue.h"
#include "../utilties/BasicType.h"
#include "../utilties/common.h"


using namespace std;

class StackValueCollection {

    BasicType* bt;


private:
    stack<StackValue*> container;



public:
    void push(StackValue* value);




    StackValue* pop();

    /**
    * 一个double用两个int存储
    * @param val
    */
    void pushDouble(double val);

    /**
     * 因为一个double占两个单元
     * 所以取的时候要连续取两个，并合并成double
     * @return
     */
    double popDouble();


    void pushInt( int type , pvoid* a  );


public:
    int maxLocals;

    int index;

    StackValue* locals;

    StackValueCollection();

    StackValueCollection(int size);

    //getLocal
    StackValue* getLocal();

    void add(int index, StackValue value);

    StackValue get(int index);



};


#endif //ANALYSIS_STACKVALUECOLLECTION_H
